#include "probability.h"

Probability::Probability(void)
{
	_traning = TraningManager::getInstance();
	_M = 0;
}

Probability::~Probability(void)
{

}

float Probability::calculatePxc(string x, string c)
{
	float ret = 0;
	float Nxc = _traning->getTrainingCountOfKeyWord(c, x);
	float Nc = _traning->getTrainingCountOfClassification(c);
	float V = _traning->getTraningClassificationsLen();
	ret = (Nxc + 1.0F) / (Nc + 0.0F + V);
	return ret;
}

float Probability::calculatePc(string c)
{
	float ret = 0;
	float Nc = _traning->getTrainingCountOfClassification(c);
	float N = _traning->getTrainingCount();
	ret = Nc / N;
	return ret;
}